package com.oamic.xiaomi.serverproject;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class TestController {
    
    @GetMapping("/test")
    public String testConnection() {
        return "Hello from Spring Boot!";
    }
    
    @GetMapping("/data")
    public TestData getTestData() {
        return new TestData("Sample Data", 123);
    }
    
    // 内部类用于测试数据返回
    public static class TestData {
        private String message;
        private int value;
        
        public TestData() {}
        
        public TestData(String message, int value) {
            this.message = message;
            this.value = value;
        }
        
        // Getters and setters
        public String getMessage() {
            return message;
        }
        
        public void setMessage(String message) {
            this.message = message;
        }
        
        public int getValue() {
            return value;
        }
        
        public void setValue(int value) {
            this.value = value;
        }
    }
}